fix: handle missing symbolic-ref for default branch detection (fixes #3) #2
+44
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #3
The action was failing with this error in GitHub Actions environments:
Root Cause
GitHub Actions checkout doesn't automatically set up the symbolic reference
refs/remotes/origin/HEADthat points to the default branch. Thegit symbolic-ref refs/remotes/origin/HEADcommand fails because this reference isn't established during the checkout process.This is a common issue in GitHub Actions environments where repositories are cloned with specific configurations that may not include all traditional git references.
Solution
Changes
validateRepository()method inGitOperationsclassgetDefaultBranch()method with multiple fallback strategiesTesting
Impact
This fix ensures the action works properly in standard GitHub Actions environments where symbolic references may not be set up, while maintaining functionality for repositories with proper git configuration.
References: